package org.ruanjj;

import org.ruanjj.baseknowleadgedemo.Address;
import org.ruanjj.baseknowleadgedemo.InstanceObjectByClone;
import org.ruanjj.inttoroman.Solution;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Main {
    public static void main(String[] args) throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException, ClassNotFoundException, CloneNotSupportedException {
        //反射构造器
        Constructor<Solution> constructor = Solution.class.getConstructor(String.class);
        Solution solution = constructor.newInstance("test");

        //反射机制对象实例化
        Class<?> clazz = Class.forName("org.ruanjj.inttoroman.Solution");
        Solution solution2 =(Solution)clazz.getDeclaredConstructor().newInstance();
        System.out.println(solution2.getA());
    }
}